<div id="importTextModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="importTextModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <form onsubmit="onSubmitImportText($('#importTextModal'));event.preventDefault();return false;">
        <div class="modal-header"><h4 class="modal-title">导入原文</h4></div>
        <div class="modal-body">
          <div class="row">
            <h4 class="col-sm-2 control-label">经典编码</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="a-code" required maxlength="10"
                     pattern="[A-Za-z][A-Za-z0-9_]+" placeholder="2~10个字母或数字，字母开头，可含_，导入后不可修改"
                     oninvalid="setCustomValidity('请输入3~10个字母或数字，字母开头，可含_')">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">对读简称</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="short-name"
                     minlength="2" maxlength="10" placeholder="2~10个汉字，分栏对读区分用">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">经典名称</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="a-name" required
                     minlength="2" maxlength="30" placeholder="2~30字，可有汉字、字母、数字、标点">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">经典类别</h4>
            <div class="col-sm-10">
              {% module RadioGroup(Article.get_field('type'), required=True) %}
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">对读宽度</h4>
            <div class="col-sm-10">
              {% module RadioGroup(Article.get_field('colspan')) %}
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">原文内容</h4>
            <div class="col-sm-10">
              <textarea class="form-control" name="a-content" rows="10" required placeholder="输入纯文本的原文内容，或网页地址(每个一行)"></textarea>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary modal-confirm">导入</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div id="importTextModal2" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="importTextModal2">
  <div class="modal-dialog">
    <div class="modal-content">
      <form onsubmit="onSubmitImportNotesText($('#importTextModal2'));event.preventDefault();return false;">
        <div class="modal-header"><h4 class="modal-title">导入原文</h4></div>
        <div class="modal-body">
          <div class="row">
            <h4 class="col-sm-2 control-label">栏名</h4>
            <div class="col-sm-10">
              <select id="modal-base" class="form-control" required>
                <option value="">请选择为哪个原文导入注解</option>
                {% for code, text, _ in codes %}
                <option value="{{code}}">{{text}}</option>
                {% end %}
              </select>
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">注解标签</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="a-tag" required
                     minlength="1" maxlength="1" placeholder="一个汉字，在一栏中区分不同注解">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">注解编码</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="a-code" required maxlength="10"
                     pattern="[A-Za-z][A-Za-z0-9_]+" placeholder="2~10个字母或数字，字母开头，可含_，导入后不可修改"
                     oninvalid="setCustomValidity('请输入3~10个字母或数字，字母开头，可含_')">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">经典名称</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="a-name" required
                     minlength="2" maxlength="30" placeholder="2~30字，可有汉字、字母、数字、标点">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">经典类别</h4>
            <div class="col-sm-10">
              {% module RadioGroup(Article.get_field('type'), required=True) %}
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">原文内容</h4>
            <div class="col-sm-10">
              <textarea class="form-control" name="a-content" rows="10" required placeholder="输入纯文本的原文内容，或网页地址(每个一行)"></textarea>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary modal-confirm">导入</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div id="appendTextModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="appendTextModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <form onsubmit="onSubmitAppendText($('#appendTextModal'));event.preventDefault();return false;">
        <div class="modal-header"><h4 class="modal-title">追加导入原文</h4></div>
        <div class="modal-body">
          <div class="row">
            <h4 class="col-sm-2 control-label">编码</h4>
            <div class="col-sm-10">
              <select id="modal-code" class="form-control" required>
                <option value="">请选择</option>
                {% for code, text, _ in codes %}
                <option value="{{code}}">{{text}}</option>
                {% end %}
              </select>
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">名称</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="s-name" required autocomplete="off"
                     minlength="2" maxlength="30" placeholder="2~30字，可有汉字、字母、数字、标点">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">原文</h4>
            <div class="col-sm-10">
              <textarea class="form-control" name="s-content" rows="10" required placeholder="输入纯文本的原文内容，或网页地址"></textarea>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary modal-confirm">导入</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div id="appendTextModal2" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="appendTextModal2">
  <div class="modal-dialog">
    <div class="modal-content">
      <form onsubmit="onSubmitAppendNotesText($('#appendTextModal2'));event.preventDefault();return false;">
        <div class="modal-header"><h4 class="modal-title">追加导入原文</h4></div>
        <div class="modal-body">
          <div class="row">
            <h4 class="col-sm-2 control-label">编码</h4>
            <div class="col-sm-10">
              <select id="modal-code2" class="form-control" required>
                <option value="">请选择</option>
                {% for code, text, notes in codes %}
                {% for note in notes %}
                <option value="{{note['code']}}">{{code}}/{{note['code']}} {{note['name']}}</option>
                {% end %}{% end %}
              </select>
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">名称</h4>
            <div class="col-sm-10">
              <input type="text" class="form-control" name="s-name" required autocomplete="off"
                     minlength="2" maxlength="30" placeholder="2~30字，可有汉字、字母、数字、标点">
            </div>
          </div>
          <div class="row">
            <h4 class="col-sm-2 control-label">原文</h4>
            <div class="col-sm-10">
              <textarea class="form-control" name="s-content" rows="10" required placeholder="输入纯文本的原文内容，或网页地址"></textarea>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary modal-confirm">导入</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div id="freeNoteModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="freeNoteModel">
  <div class="modal-dialog">
    <div class="modal-content">
      <form onsubmit="onSubmitFreeNote($('#freeNoteModel'));event.preventDefault();return false;">
        <div class="modal-header"><h4 class="modal-title">自由注解</h4></div>
        <div class="modal-body">
          <div class="row">
            <h4 class="col-sm-2 control-label">栏名</h4>
            <div class="col-sm-10">
              <select id="modal-base" class="form-control" required>
                <option value="">请选择为哪个原文合入注解</option>
                {% for code, text, _ in codes %}
                <option value="{{code}}">{{text}}</option>
                {% end %}
              </select>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary modal-confirm">前往</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div id="addNoteModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="addNoteModel">
  <div class="modal-dialog">
    <div class="modal-content">
      <form onsubmit="onSubmitFreeNote($('#addNoteModel'));event.preventDefault();return false;">
        <div class="modal-header"><h4 class="modal-title">添加注解</h4></div>
        <div class="modal-body">
          <div class="row">
            <h4 class="col-sm-2 control-label">栏名</h4>
            <div class="col-sm-10">
              <select id="modal-base" class="form-control" required>
                <option value="">请选择为哪个原文合入注解</option>
                {% for code, text, _ in codes %}
                <option value="{{code}}">{{text}}</option>
                {% end %}
              </select>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="submit" class="btn btn-primary modal-confirm">前往</button>
        </div>
      </form>
    </div>
  </div>
</div>
